package com.zetyun.tiger.format.date.compact.gbism;

import com.fasterxml.jackson.annotation.JsonClassDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.zetyun.rt.meta.jsonschema.annotation.JsonSchemaTitle;
import com.zetyun.tiger.format.date.compact.DataFormatTuple;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@Setter
@ToString
@JsonClassDescription("format 函数参数类")
public class GBISMDateFormatParameter {

    @JsonSchemaTitle("特定格式的日期字段名称(不同系统具有不同格式)")
    @JsonProperty(required = true)
    private List<GbismDataFormatTuple> tuples;


    public Map<String, GbismDataFormatTuple> toMapping() {
        return getTuples().stream()
                .collect(Collectors.toMap(GbismDataFormatTuple::getFullTbName, v -> v));
    }
}
